interface Person {
  name?: string;
  age?: number;
  address?: string;
}

type RequiredPerson = Required<Person>;

// RequiredPerson 的类型为
// {
//   name: string;
//   age: number;
//   address: string;
// }


// ReadonlyPerson 的类型为
// {
//   readonly name: string;
//   readonly age: number;
// }

type User = "Alice" | "Bob" | "Charlie";
type UserMap = Record<User, { age: number; address: string }>;

// UserMap 的类型为
// {
//   Alice: { age: number; address: string; };
//   Bob: { age: number; address: string; };
//   Charlie: { age: number; address: string; };
// }

type User = "Alice" | "Bob" | "Charlie";
type AdminUser = "Bob";

type NonAdminUser = Exclude<User, AdminUser>;

// NonAdminUser 的类型为 "Alice" | "Charlie"

type User = "Alice" | "Bob" | "Charlie";
type AdminUser = "Bob";

type AdminOnly = Extract<User, AdminUser>;

// AdminOnly 的类型为 "Bob"

interface Person {
  name: string;
  age: number;
  address: string;
  email: string;
}

type BasicPerson = Pick<Person, "name" | "age">;

// BasicPerson 的类型为
// {
//   name: string;
//   age: number;
// }

interface Person {
  name: string;
  age: number;
  address: string;
  email: string;
}

type BasicPerson = Omit<Person, "address" | "email">;

// BasicPerson 的类型为
// {
//   name: string;
//   age: number;
// }

function add(a: number, b: number): number {
  return a + b;
}

type AddReturnType = ReturnType<typeof add>;

// AddReturnType 的类型为 number